<?php
// $Id$

/**
 * @file
 * World of Warcraft theme implementation to display roster members.
 *
 * Available variables:
 * - $active: The active table column index.
 * - $header: The table header, with sorting links.
 * - $pager: A standard pager for large guilds.
 * - $players: An array containing all guild members.
 * - $inactive_filter: Whether inactive members were filtered from the roster.
 *
 * Each $player in $players contains:
 * - $player->name
 * - $player->link
 * - $player->level
 * - $player->genderName
 * - $player->genderId
 * - $player->raceName
 * - $player->raceId
 * - $player->className
 * - $player->classId
 * - $player->rankName
 * - $player->zebra
 */
?>
<table class="sticky-enabled" id="guild-roster-table">
  <thead>
    <tr><?php print $header; ?></tr>
  </thead>
  <tbody>
  <?php if (!empty($players)): ?>
    <?php foreach ($players as $player): ?>
    <tr class="<?php print $player->zebra; ?>">
      <td <?php print $active == 0 ? 'class="active"' : ''; ?>>
      <?php if (isset($player->link)): ?>
        <a href="<?php print $player->link; ?>"><?php print $player->name; ?></a>
      <?php else: ?>
        <?php print $player->name; ?>
      <?php endif; ?>
      </td>
      <td class="roster-level <?php print $active == 1 ? 'active' : ''; ?>"><?php print $player->level; ?></td>
      <td class="roster-race <?php print $active == 2 ? 'active' : ''; ?>">
        <span class="roster-race-icon r<?php print $player->raceId . '-' . $player->genderId; ?>" title="<?php print $player->raceName; ?>"></span>
      </td>
      <td class="roster-class <?php print $active == 3 ? 'active' : ''; ?>">
        <span class="roster-class-icon c<?php print $player->classId; ?>-small" title="<?php print $player->className; ?>"></span>
      </td>
      <td <?php print $active == 4 ? 'class="active"' : ''; ?>><?php print $player->rankName; ?></td>
    </tr>
    <?php endforeach; ?>
  <?php else: ?>
    <tr class="odd">
      <td colspan="5"><?php print t('No guild members found.'); ?></td>
    </tr>
  <?php endif; ?>
  </tbody>
</table>
<?php if ($inactive_filter): ?>
<div id="guild-roster-table-footnote"><?php print t('Inactive members are not displayed.'); ?></div>
<?php endif; ?>
<?php print $pager; ?>
